export default class qiu extends Laya.Script {
    P=true;
    rig=null;
    owner=((this.owner as Laya.Script))
    constructor() { 
        super(); 
        
        // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    }
    onAwake(){
        console.log(this.owner.x)
        this.rig=this.owner.getComponent(Laya.RigidBody);
        Laya.stage.on("GamerOver",this,function(){this.rig.type="static"})
        Laya.stage.on("start",this,this.start)
    }
    start(){
        this.rig.type="dynamic";
        if(this.P){
            this.owner.pos(700,340);    
        }else{
            this.owner.pos(1220,340); 
        }
        this.owner.rotation=0;

        this.rig.setVelocity({x:0,y:0})
    }
    onTriggerEnter(other){
        if(other.owner.name=="dimian"){
           if(this.owner.x<960){
            Laya.stage.event("AI+");
            Laya.stage.event("GamerOver");
            this.P=true;
        }else{
             Laya.stage.event("GamerOver");
            Laya.stage.event("Player+");
            this.P=false;
        } 
        }
        
    }
}